package cn.ruituo.jdbc;
//import com.mysql.jdbc.Driver;

import java.sql.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class SecondJdbc {
    public static void main(String[] args)  {
        try {
            Class.forName("com.mysql.jdbc.Driver");//Class
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            //System.exit(0);
            return;
        }
        //用户名，密码
        //GMT+8
        String url="jdbc:mysql://localhost:3306/java72db?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2b8&rewriteBatchedStatements=true";

        try {
            Connection connection = DriverManager.getConnection(url, "root", "root1234");
            Statement st = connection.createStatement();
            int  r=st.executeUpdate("delete from s_subject where id=56");
            System.out.printf("成功删除了%d条",r);
            st.close();
            connection.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
